//// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
//// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
//// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
//// PARTICULAR PURPOSE.
////
//// Copyright (c) Microsoft Corporation. All rights reserved

#pragma once

struct PNTVertex
{
	DirectX::XMFLOAT3 position;
	DirectX::XMFLOAT3 normal;
	DirectX::XMFLOAT2 textureCoordinate;
};

static D3D11_INPUT_ELEMENT_DESC PNTVertexLayout[] =
{
	{"POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0,  0, D3D11_INPUT_PER_VERTEX_DATA, 0},
	{"NORMAL",   0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0},
	{"TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT,    0, 24, D3D11_INPUT_PER_VERTEX_DATA, 0},
};

struct PNTBTVertex
{
	DirectX::XMFLOAT3 position;
	DirectX::XMFLOAT3 normal;
	DirectX::XMFLOAT2 textureCoordinate;
	DirectX::XMFLOAT3 bitangent;
	DirectX::XMFLOAT3 tangent;
};

static D3D11_INPUT_ELEMENT_DESC PNTBTVertexLayout[] =
{
	{"POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0,  0, D3D11_INPUT_PER_VERTEX_DATA, 0},
	{"NORMAL",   0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0},
	{"TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT,    0, 24, D3D11_INPUT_PER_VERTEX_DATA, 0},
	{"BINORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 32, D3D11_INPUT_PER_VERTEX_DATA, 0}, // This is the bitangent component but for historical reasons its semantic is BINORMAL
	{"TANGENT",  0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 44, D3D11_INPUT_PER_VERTEX_DATA, 0},
};

struct PTVertex
{
	DirectX::XMFLOAT3 position;
	DirectX::XMFLOAT2 textureCoordinate;
};

static D3D11_INPUT_ELEMENT_DESC PTVertexLayout[] =
{
	{"POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0},
	{"TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0},
};

struct BloomExtractConstantBufferChangesEveryFrame
{
	// The minimum brightness of a pixel in order for bloom to apply to it on a 0.0f (all pixels) to 1.0f (only 100% white pixels) scale.
	float BloomThreshold;
};

// BLUR_SAMPLE_COUNT must match the value in BloomBlurPixelShader.hlsl.
const int BLUR_SAMPLE_COUNT = 15;

struct BloomBlurConstantBufferChangesEveryFrame
{
	DirectX::XMFLOAT4 sampleOffsetsAndWeights[BLUR_SAMPLE_COUNT];
};

struct BloomCombineConstantBufferChangesEveryFrame
{
	// x - BloomIntensity ; y - BaseIntensity ; z - BloomSaturation ; w - BaseSaturation
	DirectX::XMFLOAT4 values;
};

struct DrawTexturedQuadConstantBufferChangeOnResize
{
	DirectX::XMFLOAT4X4 transformationMatrix;
	DirectX::XMFLOAT4 tintColor;
};

struct NormalMapStaticConstantBuffer
{
	DirectX::XMFLOAT4 lightColor;
	DirectX::XMFLOAT4 ambientLightColor;
};

struct NormalMapOnWindowSizeChangeConstantBuffer
{
	DirectX::XMFLOAT4X4 projection;
};


struct NormalMapPerFrame
{
	DirectX::XMFLOAT4X4 view;
	DirectX::XMFLOAT4 lightPosition1;
	DirectX::XMFLOAT4 lightPosition2;
	DirectX::XMFLOAT4 lightPosition3;
};

struct NormalMapPerMesh
{
	DirectX::XMFLOAT4X4 world;
	DirectX::XMFLOAT4X4 worldInverseTranspose;
	float shininess;
	float specularPower;
};

struct GlassShatterOnWindowSizeChange
{
	DirectX::XMFLOAT4X4 Projection;
	DirectX::XMFLOAT4 AmbientColor;
	DirectX::XMFLOAT4 DiffuseColor;
	// x,y,z - Specular Color. w = Specular power.
	DirectX::XMFLOAT4 SpecularColorAndSpecularPower;
	// x, y, z = Light Position. z = Time that particles fade out, in seconds.
	DirectX::XMFLOAT4 LightPositionAndParticleFadeOutTime;
};

struct GlassShatterPerFrame
{
	DirectX::XMFLOAT4X4 View;
	// x - Rotation amount. y - Translation amount. z - Time in seconds since the effect started.
	DirectX::XMFLOAT4 RotAmountTranslatAmountTimeSinceStart;
	// x, y, z - camera location.
	DirectX::XMFLOAT4 EyePosition;
};

struct GlassShatterPerMesh
{
	DirectX::XMFLOAT4X4 World;
};
